<?php

require_once '../../config/config.inc.php';
require_once _PS_ROOT_DIR_.'/init.php';

if (!$cookie->isLogged())
    Tools::redirect('authentication.php?back=order.php');

if ($cart->OrderExists()) 
	Tools::redirect('history.php');

require_once _PS_ROOT_DIR_.'/header.php';

$dir = rtrim(dirname(__FILE__), '/');
$module = explode('/', $dir);
$module = $module[count($module)-1];
require_once $dir.'/'.$module.'.php';

$Module = new $module;
$atos_form = $Module->getPaymentForm($amount, $payment_currency);

$smarty->assign(compact(
	'atos_form',
	'amount',
	'payment_currency'
));
$smarty->assign('module_dir', __PS_BASE_URI__.'modules/'.$module.'/');

if (is_file(_PS_THEME_DIR_.'modules/'.$module.'/tpl/'.$module.'-front-payment-redirect.tpl'))
	$smarty->display(_PS_THEME_DIR_.'modules/'.$module.'/tpl/'.$module.'-front-payment-redirect.tpl');
else
	$smarty->display(_PS_MODULE_DIR_.$module.'/tpl/'.$module.'-front-payment-redirect.tpl');

require_once _PS_ROOT_DIR_.'/footer.php';

?>